<template>
  <div class="home">
    <div>{{ count }}</div>
    <button @click="add">++</button>
    <button @click="addAnync">异步++</button>
    <button @click="ADD">异步+N</button>
    <button>{{ showNumber }}</button>
  </div>
</template>

<script>
import { mapMutations, mapState, mapActions, mapGetters } from "vuex";
export default {
  computed: { ...mapState(["count"]) },
  methods: {
    ...mapGetters(["showNumber"]),
    ...mapMutations(["countAdd"]),
    ...mapActions(["addAnync", "addNumAsync"]),
    add() {
      this.countAdd();
    },
    ADD() {
      // 调用全局异步处理
      this.addNumAsync(8);
    },
  },
};
</script>
